#include "ftpTrans.h"
#include "downloadHelp.h"
#include <iostream>
using std::cout;
using std::endl;
int main()
{
    FtpTrans ftp;



    ftp.login("192.168……", "user", "password", 1000); 
    // login ftp server user password
    
    
    std::vector<FILE_INFO> v1;
    
    ftp.dirlist("192.168……/ftpdir/", "", v1);
    // get server dir filename
    
    std::string str = "ftp://192.168……/ftpdir/";
    std::string local_str = "/home/lighthouse/threadTest/ftp/";
    
    for (auto &iter : v1)
    {
        std::string download_str = str;
        std::string local_dir = local_str;

        download_str = download_str + iter.name;
        local_dir = local_dir + iter.name;
        // Permutation file name

        
        ftp.download(download_str.c_str(),local_dir.c_str(),1);
        // download server file 

        cout << "name = " << iter.name << "   " << download_str << "  " << local_dir << endl;
    }
}